-
Notifications
You must be signed in to change notification settings - Fork 155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improvements and bug fixes for sizeof calculator #236
base: master
Are you sure you want to change the base?
Conversation
@generalmimon , I see that you've started to merge some PRs and close issues. Could you look at my PRs? This one is a good candidate to start. List of all my PRs: https://github.com/pulls?page=1&q=is%3Aopen+is%3Apr+author%3AMingun+archived%3Afalse+org%3Akaitai-io |
bba5067
to
b1bc207
Compare
bb40c22
to
d00f859
Compare
@GreyCat, @generalmimon, I see that you have some activity in the project recently. Could you find a time to review my PRs, for example, this? |
1e3c413
to
4346a1f
Compare
d972411
to
c33618e
Compare
ff2df58
to
ee12aec
Compare
Part of them already was sealed, so there is no reasons to not seal other
Both ArrayTypeInStream and CalcArrayType the only existing successors of the sealed class TypeDetector so we can do that simplification
Fow now only very basic tests is implemented - only size of built-in types is tested
The following tests failed before the change: [info] Ast$Test: [info] - considers `false and ?` constant *** FAILED *** [info] None was not equal to Some(false) (Ast$Test.scala:67) [info] - considers `? and false` constant *** FAILED *** [info] None was not equal to Some(false) (Ast$Test.scala:74) [info] - considers `true or ?` constant *** FAILED *** [info] None was not equal to Some(true) (Ast$Test.scala:81) [info] - considers `? or true` constant *** FAILED *** [info] None was not equal to Some(true) (Ast$Test.scala:88)
- Forbid negative counts of repetitions in `repeat-expr` - Warn about zero counts in `repeat-expr` - Forbid falsy values in `repeat-until` - Warn about only one iteration in `repeat-until`
@generalmimon, @GreyCat, there already almost 3 years past. Could you look at this? |
This PR improves situation with
_sizeof
/sizeof<>
:switch-on
types with the same size in all arms now correctly have the constant sizeif
keys now correctly influence to class / attributesizeof
(fixes_sizeof
special property does not properly handle conditional fields kaitai_struct#927)repeat-expr
keyrepeat-until: <falsy value>
because that will lead to an infinity cycleThis PR is based on the #225 because the last commit (f6238c0) from that PR is needed for correct
switch-on
size calculationsAlso this PR fixes the
expr_sizeof_value_dynamic3.ksy
test -- corresponding PR to the tests repository: kaitai-io/kaitai_struct_tests#95. Also, this test was mentioned in the kaitai-io/kaitai_struct#721